package com.example.thirdjarlearninguse.controller;

import com.example.thirdjarlearningcore.ThirdJarBeanOne;
import com.example.thirdjarlearningcore.annotation.ThirdJarCotAsBean;
import com.example.thirdjarlearninguse.entity.ThirdJarCotAsBeanOne;
import com.example.thirdjarlearninguse.entity.ThirdJarCotAsBeanSec;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/third_jar_learning_use")
@RestController
public class useThirdJarController {
    @Autowired
    ThirdJarBeanOne thirdJarBeanOne;

    @GetMapping("/test1")
    public String test1(){
        System.out.println(thirdJarBeanOne.getNickName() + " " + thirdJarBeanOne.getAge());
        return "ok";
    }

    @Qualifier(value = "cotAsBeanOne")
    @Autowired
    ThirdJarCotAsBeanOne thirdJarCotAsBeanOne;
    @Autowired
    ThirdJarCotAsBeanSec thirdJarCotAsBeanSec;

    @GetMapping("/test2")
    public String test2(){
        System.out.println(thirdJarCotAsBeanOne.getSchool() + " " + thirdJarCotAsBeanOne.getInCome());
        System.out.println(thirdJarCotAsBeanSec.getName());
        return "ok";
    }


}
